<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fy.model.Student" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>修改学生信息</title>
		<meta name="keywords" content="学生,信息,管理,系统">
		<meta name="description" content="学生信息管理系统">
		<%@ include file="../public/head.jspf"%>
    	<style type="text/css">
			input[type='text'], textarea{width:90%;}
			label[class='btn']{margin:0 10px;padding:5px;}
		</style>
	</head>
	<body>
		<div class="box">
			<h1>学生信息管理系统<a class="back">返回</a></h1>
			<div class="content">
				<div id="data">
					<table id="datalist">
						<caption>修改前的学生信息</caption>
						<tr>
							<th>学号</th>
							<th>姓名</th>
							<th>年龄</th>
							<th>性别</th>
							<th>专业</th>
						</tr>
					    <%
					    	int id = 0;
			    	    	ArrayList<Student> result = new ArrayList<Student>();
			    	    	result = (ArrayList<Student>) request.getAttribute("result");
			    	    	if (!result.isEmpty()) {
			    	    		for (int i = 0; i < result.size(); i++) {
			    	    			Student st = result.get(i);
			    	    			id = st.getId();
			    	    			out.println("<tr>");
			    	    			out.println("							<td>" + st.getId() + "</td>");
			    	    			out.println("							<td>" + st.getName() + "</td>");
			    	    			out.println("							<td>" + st.getAge() + "</td>");
			    	    			out.println("							<td>" + st.getGender() + "</td>");
			    	    			out.println("							<td>" + st.getMajor() + "</td>");
			    	    			out.print("						</tr>");
			    	    		}
			    	    	}
					    %>
	    			</table>
					<form action="students" method="post">
						<table id="datalist">
					    	<caption>修改后的学生信息<input type="hidden" name="methodName" value="3" /></caption>
					    	<tr>
								<td>学号：</td>
								<td><input type="text" name="id" value="<%=id %>" title="学号不能改变" /></td>
							</tr>
							<tr>
								<td>姓名：</td>
								<td><input type="text" name="name" title="姓名不能为空" /></td>
							</tr>
							<tr>
								<td>年龄：</td>
								<td><input type="text" name="age" title="年龄不能为空" /></td>
							</tr>
							<tr>
								<td>性别：</td>
								<td>
									<label class="btn"><input type="radio" name="gender" value="男" />男</label>
									<label class="btn"><input type="radio" name="gender" value="女" />女</label>
								</td>
							</tr>
							<tr>
								<td>专业：</td>
								<td><input type="text" name="major" title="专业不能为空" /></td>
							</tr>
							<tr>
								<td colspan="2">
									<input type="submit" class="btn green" value="修改" />
									<input type="button" class="btn blue" value="查看列表"
										onclick="location.href='students?methodName=1'" />
								</td>
							</tr>
						</table>
					</form>
    			</div>
			</div>
		</div>
	</body>
</html>